function [Cdif,Cdif_i,Cdif_i_early,Cdif_i_late,Cdif_dep,Cdif_tax,...
    MC_app0,MC_app0_i,MC_app0_i_early,MC_app0_i_late,MC_app0_dep,MC_app0_tax] ...
    = fn_dWdd_main_app0(R1,delta,D0,chi,prob,phi,dist_s,s_min,s_max,dist_d,...
    d_min,d_max,kappa,s_hat,s_star,lambda,y1,y2,Y1tau,gam,d_grid)
%% omega/CF at s_star
T_star        = fn_tax(delta,R1,D0,chi,s_star,phi,dist_d,d_min,d_max); % T(s^*)

CF_tax        = Y1tau - fn_kappa_gross(T_star,kappa);


%% Marginal Benefit

% Depositors gap (aggregate)
f_Cdif_i      = @(D0i) fn_Cdif_i(D0i,R1,delta,D0,chi,lambda,y1,y2,phi,dist_d,d_min,d_max,s_star).*dist_d.pdf(D0i);

Cdif_dep      = integral(f_Cdif_i,     d_min,d_max);

% Depositors gap (individual/early/late)
[Cdif_i,Cdif_i_early,Cdif_i_late] = fn_Cdif_i(d_grid',R1,delta,D0,chi,lambda,y1,y2,phi,dist_d,d_min,d_max,s_star);

% Taxpayers gap
Cdif_tax      = Y1tau - CF_tax; % = fn_kappa_gross(T_star,kappa)

% Depositors + Taxpayers
Cdif      = Cdif_dep      + Cdif_tax;


%% Marginal Cost

% Depositors (aggregate)
f_cost_app0_dep_i = @(D0i) fn_cost_app_i_integral(D0i,R1,delta,D0,chi,gam,lambda,y1,y2,phi,s_min,s_max,dist_d,d_min,d_max,s_star,s_hat,dist_s,prob).*dist_d.pdf(D0i);

MC_app0_dep = integral(f_cost_app0_dep_i,d_min,d_max);

% Depositors (individual)
MC_app0_i = fn_cost_app_i_integral(d_grid,R1,delta,D0,chi,gam,lambda,y1,y2,phi,s_min,s_max,dist_d,d_min,d_max,s_star,s_hat,dist_s,prob)';

% Depositors (early/late)
MC_app0_i_early = MC_app0_i;
MC_app0_i_late  = MC_app0_i;


% Taxpayers
MC_app0_tax = fn_int_cost_app_tax(R1,delta,D0,chi,gam,prob,phi,dist_s,s_min,s_max,dist_d,d_min,d_max,s_hat,s_star,Y1tau,kappa);

% Depositors + Taxpayers
MC_app0 = MC_app0_dep + MC_app0_tax;


end
